﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
using UltraToys.Excel;

namespace ExcelTest
{
    public partial class ThisAddIn
    {
        private Excel.Range _Range;
        private Excel.Worksheet _Sheet;

        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            _Sheet = this.Application.ActiveSheet as Excel.Worksheet;

            //Test 1 - 1 Cell
            _Range = _Sheet.Range("A1");
            _Range.Value2 = "Test";

            //Test 2 - 4 Cells
            _Range = _Sheet.Range("B1:B4");
            _Range.Value2 = "Test 2";

            //Test 3 - 2 different Cells
            _Range = _Sheet.Range("C1", "C5");
            _Range.Value2 = "Test 3";

            
        }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
        }

        #region VSTO generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
        
        #endregion
    }
}
